using System;
using System.Configuration;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Text;
using System.Web;
using System.Web.UI;

namespace AspAlliance.SimpleCms
{
    class CmsPageBase : Page
    {

        protected CmsSettings CmsConfig = (CmsSettings)ConfigurationManager.GetSection(Resources.ConfigSection);

        public CmsPageBase()
        {
        }

        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
        }

        protected void RenderBeginning(HtmlTextWriter writer, string title, string description, string keywords)
        {
            writer.RenderBeginTag(HtmlTextWriterTag.Html);

            writer.RenderBeginTag(HtmlTextWriterTag.Head);
            writer.RenderBeginTag(HtmlTextWriterTag.Title);
            Server.HtmlEncode(title, writer);
            writer.RenderEndTag(); // </title>
            writer.WriteLine();

            writer.WriteBeginTag("meta");
            writer.WriteAttribute("name","Description");
            writer.WriteAttribute("content", description);
            writer.WriteLine(" />");

            writer.WriteBeginTag("meta");
            writer.WriteAttribute("name", "Keywords");
            writer.WriteAttribute("content", keywords);
            writer.WriteLine(" />");

            writer.RenderEndTag(); // </head>
            writer.WriteLine();

            writer.RenderBeginTag(HtmlTextWriterTag.Body);
        }

        protected void RenderEnd(HtmlTextWriter writer)
        {
            writer.RenderEndTag(); // </body>
            writer.WriteLine();

            writer.RenderEndTag(); // </html>
            writer.WriteLine();
        }

        protected override void Render(HtmlTextWriter writer)
        {
            base.Render(writer);
        }
    }
}
